/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.itriage.hospital.client.web.webservices.REST;

import com.itriage.hospital.model.Staff;
import com.itriage.hospital.services.StaffService;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/**
 *
 * @author TestAccount
 */
@Controller
@RequestMapping("api")
public class RESTController {
    
    @Autowired
    private StaffService service;
    ResourceAssembler resourceAssembler;
    
    @RequestMapping(value= "staff",method = RequestMethod.GET)
    ResponseEntity<List<StaffResource>> getEmps()
    {
        resourceAssembler = new ResourceAssembler();
        List<Staff> l = service.getStaff();
        List<StaffResource> list = resourceAssembler.toResources(l);
        return new ResponseEntity<List<StaffResource>>(list, HttpStatus.OK);
    }
}
